<!doctype html>
<html class="no-js" manifest="__PUBLIC__/home/manifest/test.manifest">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <title>登录</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="绵阳中学英才学校" />
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileColor" content="#0e90d2">
    <link rel="stylesheet" href="__PUBLIC__/home/css/amazeui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/login.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/reg.css">
</head>

<body>
    <!-- 头部 -->
    <header data-am-widget="header" class="am-header am-header-default">
      <div class="am-header-left am-header-nav">
        <a href="javascript:history.go(-1);" class="am-header-left1">
          <img src="__PUBLIC__/home/images/back.png" alt="">
        </a>
      </div>
      <div class="am-header-right am-header-nav">
        <a href="{:U('Index/index')}" class="am-header-right1">
          <img src="__PUBLIC__/home/images/home.png" alt="">
        </a>
      </div>
    </header>

    <!-- 中间 -->
    <div class="content">
      <div class="am-g">
        <div class="am-u-sm-11 am-u-sm-centered">
          <img src="__PUBLIC__/home/images/login_logo.png" alt="">
        </div>
      </div>

        <div class="am-g login_form">
          <div class="am-u-sm-11 am-u-sm-centered">
            <div  class="am-header-left login_name">用户名/手机号&nbsp;:</div>
            <input type="username" name="username" class="name_text am-header-right login_text1">
          </div>
        </div>
        <div class="am-g">
          <div class="am-u-sm-11 am-u-sm-centered">
            <div  class="am-header-left login_password">密&nbsp;&nbsp;码&nbsp;:</div>
            <input type="password" name="password" class="name_text am-header-right login_text2">
          </div>
        </div>

        <div class="am-g">
          <div class="am-u-sm-11 am-u-sm-centered login_login">
              <button class="am-btn am-btn-success am-u-sm-7" id="btn">登&nbsp;录</button>
              <button type="button" class="am-btn am-btn-success am-u-sm-4" onclick="javascript:window.location.href='__APP__/Login/register'">注&nbsp;册</button>
          </div>
        </div>
        <div data-am-widget="header" class="am-header am-header-default">
          <div class="am-header-right am-header-nav">
            <a href="{:U('Login/forget_password')}" class="am-header-right1">
           		忘记密码？
            </a>
          </div>
        </div>
    </div>


    <script src="__PUBLIC__/home/js/jquery.min.js"></script>
    <script src="__PUBLIC__/home/js/amazeui.min.js"></script>
    <script>
    $(function(){
    	$('#btn').click(function(){
    		var user = $("input[name=username]").val();
    		var psw = $("input[name=password]").val();
    		if(user && psw){
    			$.ajax({
        			type:"POST",
        			url:"{:U('Login/login')}",
        			data:{'username':user,'password':psw},
        			success:function(data){
        				console.log(data);
        				if(data==1){
        					alert('登录成功');
        					window.location.href = '__APP__/User/user_center';
        				}else if(data==0){
        					alert('用户名或密码错误');
        				}
        			}
        		});
    		}else{
    			alert('内容不能为空');
    		}
    		
    	});
    });
    </script>
</body>

</html>
